<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<h:outputStylesheet library="css" name="styles.css"/>
	<title>#{msgs.browserTitle}</title>
</h:head>
<h:body>

	<h:form>
		
		<h:panelGrid columns="3" rows="2">
        	<h:panelGrid columns="2">
        		<h:outputText value="Employee Number:" style="font-weight:bold"/>
        		<h:outputText value="#{loggedIn.employee.userID}"/>               	              
        	</h:panelGrid>
        	
        	<h:panelGrid columns="2">
        		<h:outputText value="Week Number: " style="font-weight:bold"/>
	            <h:outputText value="#{loggedIn.weekNumber}"/>
              	                
        	</h:panelGrid>
        	
        	<h:panelGrid columns="2">
		       	<h:outputText value="Week Ending: " style="font-weight:bold"/>
		        <h:outputText value="????"/>		        
        	</h:panelGrid>
        	
        	
        	<h:panelGrid columns="3">
		    	<h:outputText value="Name: " style="font-weight:bold"/>
               	<h:outputText value="#{loggedIn.employee.firstName}"/>
		        <h:outputText value="#{loggedIn.employee.lastName}"/>   	
        	</h:panelGrid>    

        </h:panelGrid>
		<h:dataTable value="#{loggedIn.getProjects()}" var="project" styleClass="names" 
                      headerClass="namesHeader" columnClasses="lastName,firstName,password"
                      footerClass="nameFooter">
			
			<h:column>
				<f:facet name="header">Project</f:facet>
				<h:inputText value="#{project.projectID}" rendered="#{project.edit}" size="10" required="true"/>
	            <h:outputText value="#{project.projectID}" rendered="#{not project.edit}"/>
	            
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>	            	
	            		<h:outputFormat value="Total" />
	            		<h:inputText value="#{newProjectRow.projectRow.projectID}" size="10"/>	            		            		
	            	</h:panelGrid>
	            </f:facet>
	            
			</h:column>
			
			<h:column>
				<f:facet name="header">WP</f:facet>
				<h:inputText value="#{project.workPlace}" rendered="#{project.edit}" size="10" required="true"/>
	            <h:outputText value="#{project.workPlace}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="." />
	            		<h:inputText value="#{newProjectRow.projectRow.workPlace}" />	            			            		
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column><f:facet name="header">Total</f:facet>

				<h:inputText value="#{project.totalWeeklyHours()}" rendered="#{project.edit}" 
	                            size="10"/>
	            <h:outputText value="#{project.totalWeeklyHours()}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getWeeklyTotal()}" />
						<h:outputFormat value="." />	            			            			            		
	            	</h:panelGrid>
	            </f:facet>

			</h:column>
			<h:column><f:facet name="header">Sat</f:facet>
				<h:inputText value="#{project.saturday}" rendered="#{project.edit}" size="3">
					<f:validateBean validationGroups="ca.bcit.comp_3512.assignment_01.helpers.NewProjectrow.class "/>
				</h:inputText>
	            <h:outputText value="#{project.saturday}" rendered="#{not project.edit}"/>
				<f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getSaturdayTotal()}" />
	            		<h:inputText value="#{newProjectRow.projectRow.saturday}" />	            			            		
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column>
				<f:facet name="header">Sun</f:facet>
				<h:inputText value="#{project.sunday}" rendered="#{project.edit}" size="3"/>
	            <h:outputText value="#{project.sunday}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getSundayTotal()}" />	            		
	            		<h:inputText value="#{newProjectRow.projectRow.sunday}" />
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column>
				<f:facet name="header">Mon</f:facet>
				<h:inputText value="#{project.monday}" rendered="#{project.edit}" size="3"/>
	            <h:outputText value="#{project.monday}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getMondayTotal()}" />	            		
	            		<h:inputText value="#{newProjectRow.projectRow.monday}" />
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column>
				<f:facet name="header">Tue</f:facet>
				<h:inputText value="#{project.tuesday}" rendered="#{project.edit}" size="3"/>
	            <h:outputText value="#{project.tuesday}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getTuesdayTotal()}" />
	            		<h:inputText value="#{newProjectRow.projectRow.tuesday}" />	            		            		
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column>
				<f:facet name="header">Wed</f:facet>
				<h:inputText value="#{project.wednesday}" rendered="#{project.edit}" size="3"/>
	            <h:outputText value="#{project.wednesday}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getWednesdayTotal()}" />
	            		<h:inputText value="#{newProjectRow.projectRow.wednesday}" />	            			            		
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column>
				<f:facet name="header">Thu</f:facet>
				<h:inputText value="#{project.thursday}" rendered="#{project.edit}" size="3"/>
	            <h:outputText value="#{project.thursday}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getThursdayTotal()}" />	            		
	            		<h:inputText value="#{newProjectRow.projectRow.thursday}" />
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			
			<h:column>
				<f:facet name="header">Fri</f:facet>
				<h:inputText value="#{project.friday}" rendered="#{project.edit}" size="3"/>
	            <h:outputText value="#{project.friday}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value="#{loggedIn.getFridayTotal()}" />	            		
	            		<h:inputText value="#{newProjectRow.projectRow.friday}" />
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column>
				<f:facet name="header">Note</f:facet>
				<h:inputText value="#{project.notes}" rendered="#{project.edit}" size="3"/>
	            <h:outputText value="#{project.notes}" rendered="#{not project.edit}"/>
	            <f:facet name="footer">
	            	
	            	<h:panelGrid>
	            		<h:outputFormat value= "." />	            			            		
	            		<h:inputText value="#{newProjectRow.projectRow.notes}" />
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
						
			<h:column>
				<f:facet name="header">Delete/Add</f:facet>
				<h:commandButton value="Delete" action = "#{deleteEmp.deleteEmployee(project)}"/>
				
				<f:facet name="footer">	            	
	            	<h:panelGrid>	            	
	            		<h:outputFormat value="." />	            		
	            		<h:commandButton id="id_buttonAdd" value="Add" action="#{loggedIn.addRow}" />
	            	</h:panelGrid>
	            </f:facet>
			</h:column>
			
			<h:column>
				<f:facet name="header">Edit</f:facet>			
				<h:selectBooleanCheckbox value="#{project.edit}" onclick="submit()"/>
			</h:column>
			
			
			
		</h:dataTable>
		<h:commandButton id="id_buttonAdd" value="Add" action="#{loggedIn.addRow}" />
		<h:commandButton id="id_buttonBack" value="back" action="menu" />
		</h:form>

		
	</h:body>
</html>